<template>
  <div class="test-chart">
    <h2>图表测试页面</h2>
    <div id="testChart" style="width: 100%; height: 400px;"></div>
  </div>
</template>

<script>
import * as echarts from 'echarts';

export default {
  name: "TestChart",
  mounted() {
    this.initChart();
  },
  methods: {
    initChart() {
      const chartDom = document.getElementById('testChart');
      const myChart = echarts.init(chartDom);
      
      const option = {
        title: {
          text: '测试图表'
        },
        tooltip: {},
        xAxis: {
          data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
        },
        yAxis: {},
        series: [{
          name: '销量',
          type: 'bar',
          data: [5, 20, 36, 10, 10, 20]
        }]
      };
      
      myChart.setOption(option);
    }
  }
}
</script>

<style scoped>
.test-chart {
  padding: 20px;
}
</style>
